package com.woniu.controller;

import com.woniu.anno.Idempotent;
import com.woniu.req.Order;
import com.woniu.req.RequestData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 请求参数：
 * {
 *     "data": {
 *         "orderId": "12345",
 *         "amount": 100.50
 *     },
 *     "header": {
 *         "token": "fae813f5-3c7b-4019-8706-9e7f31db3c60"
 *     }
 * }
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @RequestMapping("/saveOrder")
    @Idempotent(name = "requestData", type = RequestData.class, field = "token")
    public String saveOrder(@RequestBody RequestData<Order> requestData) {
        return "success";
    }

}